#include "module_base/test_nodelet.h"

namespace module_base
{

void TestNodelet::onInit()
{
	init_nodelet();
	// subscribers_["input"]=nh_.subscribe(params_["input_topic"],
	// 	10,&TestNodelet::test_callback,this);
	// publishers_["output"]=nh_.advertise<std_msgs::String>(
	// 	params_["output_topic"],10);
	CREATE_SUBSCRIPION(params_["input_topic"],
		&TestNodelet::test_callback,10);

	CREATE_PUBLISHER<std_msgs::String>("output",params_["output_topic"],10);
}

void TestNodelet::test_callback(const std_msgs::StringConstPtr& msg)
{
	ROS_INFO("I heared: %s",msg->data.c_str());
	std_msgs::String output_msg;
	output_msg.data=msg->data;
	publishers_["output"].publish(output_msg);
}

}

PLUGINLIB_EXPORT_CLASS(module_base::TestNodelet, nodelet::Nodelet)